

#include "desktop.h"



ControlPage::ControlPage()
{
  this->viewpoint = new Container(this);
  this->viewpoint->set_size(240, 260);
  this->viewpoint->set_bg_color(lv_color_hex(THEME_COLOR_BLUE), 0, LV_PART_MAIN | LV_STATE_DEFAULT);
  this->viewpoint->set_flex_layout(LV_FLEX_FLOW_COLUMN, false, false, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);



  this->control_bar = new Container(this->viewpoint);
  control_bar->set_size(220, 160);
  control_bar->set_radius(16);

  this->wifi_switch = new ButtonSwitch(control_bar);
  lv_obj_align(wifi_switch->get_lv_obj_t(), LV_ALIGN_TOP_LEFT, 0, 0);
  wifi_switch->set_icon(&ui_img_wifi_png);


  this->bluetooth_switch = new ButtonSwitch(control_bar);
  lv_obj_align(bluetooth_switch->get_lv_obj_t(), LV_ALIGN_TOP_MID, 0, 0);
  bluetooth_switch->set_icon(&ui_img_bluetooth_png);


  this->bell_switch = new ButtonSwitch(control_bar);
  lv_obj_align(bell_switch->get_lv_obj_t(), LV_ALIGN_TOP_RIGHT, 0, 0);
  bell_switch->set_icon(&ui_img_bell_png);


  this->setting_switch = new ButtonSwitch(control_bar);
  lv_obj_align_to(setting_switch->get_lv_obj_t(), wifi_switch->get_lv_obj_t(), LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
  setting_switch->set_icon(&ui_img_setting_png);


  this->shutdowm_switch = new ButtonSwitch(control_bar);
  lv_obj_align_to(shutdowm_switch->get_lv_obj_t(), bluetooth_switch->get_lv_obj_t(), LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
  shutdowm_switch->set_icon(&ui_img_offon_png);


  this->light_switch = new ButtonSwitch(control_bar);
  lv_obj_align_to(light_switch->get_lv_obj_t(), bell_switch->get_lv_obj_t(), LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
  light_switch->set_icon(&ui_img_light_png);

  this->light_bar = new Container(this->viewpoint);
  light_bar->set_size(220, 64);
  light_bar->set_flex_layout(LV_FLEX_FLOW_ROW, false, false, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
  light_bar->set_radius(16);

  this->moon_icon = new Image(light_bar);
  moon_icon->set_size(24, 24);
  moon_icon->set_img(&ui_img_moon_png);

  this->light_slider = new Slider(light_bar);
  light_slider->set_size(140, 32);
  light_slider->set_range(0, 255);
  light_slider->set_value(128);
  light_slider->hide_knob();

  this->bright_icon = new Image(light_bar);
  bright_icon->set_size(24, 24);
  bright_icon->set_img(&ui_img_sun_png);



}

ControlPage::~ControlPage()
{
}
